package org.ogv.usada.models;

import org.ogv.OGV;

import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class Splash {
	
	private float 	_timeLeft;
	private boolean _enable;
	private Sprite	_sprite;

	public Splash init(float x, float y, float timeLeft) {
		_sprite 	= new Sprite(OGV.asset.getTextureRegion(new String[]{"data/pack", "pot-splash0"}));
		_timeLeft 	= timeLeft;
		_sprite.setPosition(x, y);
		_enable = true;
		
		return this;
	}
	
	public void update(float delta) {
		if(_enable && _timeLeft > 0) {
			_timeLeft -= delta;
			if(_timeLeft <= 0) _enable = false;
		}
	}
	
	public void draw(SpriteBatch sb) {
		if(_enable) _sprite.draw(sb);
	}
	
	public boolean enabled() {
		return _enable;
	}
	
	public void enable(boolean val) {
		_enable = val;
	}
	
	public Splash() {
		_enable 	= false;
	}
}
